﻿﻿﻿@extends('admin.Default')
@section('type')
    <!-- Data Tables -->
    <link href="{{ asset('myadmin/css/plugins/summernote/summernote.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/summernote/summernote-bs3.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/dropzone/basic.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/dropzone/dropzone.css') }}" rel="stylesheet">
@stop
@section('content')
    <style type="text/css">
        body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}
        #l-map{height:300px;width:50%;}
        #r-result{width:100%;}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=keXdM18CTQm5jrHeydPispemtrz5Y00v"></script>
    <div class="col-md-8" style="margin-top:50px;margin-left:330px;">
        <form action="" method="post" >
            <input type='hidden' name='_token' value='{{ csrf_token() }}'>
        <div class="form-group row">
            <label class="col-sm-2 control-label">账　　号：</label>
            <div class="col-sm-6">
                <input type="text" name="username" class="form-control"  placeholder="手机号码"  onblur="demo(this);">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 control-label">密　　码：</label>
            <div class="col-sm-6">
                <input type="password" name="password" class="form-control"  placeholder="密码">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 control-label">确认密码：</label>
            <div class="col-sm-6">
                <input type="password" name="pwd" class="form-control"  placeholder="确认密码"  onblur="pass(this);">
            </div>
        </div>

        <button class="btn btn-primary" type="button" onclick="regis(this)" style="margin-left: 200px;"><strong>提交</strong></button>
        <button class="btn btn-primary" type="reset"><strong>重置</strong></button>
        </form>
    </div>
@stop
@section('script')
    <!-- SUMMERNOTE -->
    <script src="{{ asset('myadmin/js/plugins/summernote/summernote.min.js') }}"></script>
    <script src="{{ asset('myadmin/js/plugins/summernote/summernote-zh-CN.js') }}"></script>
    <script src="{{ asset('myadmin/js/plugins/dropzone/dropzone.js') }}"></script>
    <script src="{{ asset('tools/form-builder/beautifyhtml.js') }}"></script>
    <script>
        function demo(bn){
            var name = $(bn).attr('name');
            var val = $(bn).val();
            $.ajax({
                url:"{{url('home/user/ajax/resgName') }}",
                async:false,
                data:{'name':name, 'value':val, '_token':$('input[name=_token]').val()},
                type:"post",
                dataType:"json",
                error:function(){

                },
                success:function(data){
                    if(data != '1') {
                        $("input[name=username]").val("");
                        alert(data);

                    }
                }
            });
        }
        function pass(bn){
            var pwd = $(bn).val();
            var password = $("input[name=password]").val();

            if(pwd == ""){
                alert("确认密码不能为空！");
            }else{
                if(pwd != password){
                    $(bn).val("")
                    alert("两次密码不一致！");
                }
            }

        }

        function regis() {

            var username = $("input[name=username]").val();
            var password = $("input[name=password]").val();
            var pass = $("input[name=pwd]").val();
            if (username == '' || password == '' || pass == '') {
                alert("请将信息填写完整！");
            }else{
                $.ajax({
                    url: "{{url('admin/user/ajax/regsuc') }}",
                    async: true,
                    data: {'username': username, 'password': password, '_token': $('input[name=_token]').val()},
                    type: "post",
                    dataType: "json",

                    success: function (data) {

                        alert(data);
                        if(data == '账号注册成功!'){

                        }
                        $("input[name=username]").val('');
                        $("input[name=password]").val('');
                        $("input[name=pwd]").val('');
                    }
                });
            }
        }
    </script>

    <script>
        $(document).ready(function () {

            $('.summernote').summernote({
                lang: 'zh-CN'
            });

        });
    </script>
@stop
